using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;

namespace TVT.UI.UserControls
{
    public partial class DatePicker : System.Web.UI.UserControl
    {        
        public DateTime SelectedDate
        {
            get{ if (txtDate.Text == "") return DateTime.Now; else return DateTime.Parse(txtDate.Text, DateTimeFormatInfo.GetInstance(new CultureInfo("en-US"))); }
            set {  txtDate.Text = value.ToString(Resources.DateFormat); }
        }

        public string Title
        {
            get { if (lblTitle.Text == "") return "Date:"; else return lblTitle.Text; }
            set { lblTitle.Text = value; }
        }

        public DateTime GetSelectedDateAsEndDate()
        {
            return new DateTime(SelectedDate.Year, SelectedDate.Month, SelectedDate.Day, 23, 59, 59);
        }

        public DateTime GetSelectedDateAsStartDate()
        {
            return new DateTime(SelectedDate.Year, SelectedDate.Month, SelectedDate.Day, 0, 0, 0);
        }
        
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
    }
}